<?php

/**
* Products Module Configure
* 
* @author trungdt
* @since Sep 26, 2011
* Change logs
* 
*    
*/

class productsmodule_config {
	function form($object) {
		if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
		exponent_forms_initialize();

		$form = new form();
		if (!isset($object->id)) {
			$object->chain_src='';
			$object->generate_menu=0;
            $object->section_seo_name='';
			$object->currency_id =0;
			
		} else {
			$form->meta('id',$object->id);
		}
		
		$form->register("chain_src","Source Module to CHAIN",new textcontrol($object->chain_src,50,false,250,"",false));
		$form->register("generate_menu","Generate Navigation Menu",new checkboxcontrol($object->generate_menu,true));
		$form->register("section_seo_name","Host section Seo Name to generate sub menus",new textcontrol($object->section_seo_name,50,false,250,"",false));
		//
        // Oct 14, 2011 - trungdt 
        // add currency support
        global $db;
        $currency=$db->selectDropdown("productsmodule_currency", "name");
        $form->register("currency_id", "Default Currency", new dropdowncontrol($object->currency_id,$currency));
        
        // Oct 14, 2011 - trungdt -  end currency support
		$form->register('submit','',new buttongroupcontrol('Save','','Cancel'));
		return $form;
	}

	function update($values,$object) {
		$object->chain_src=$values['chain_src'];
		$object->generate_menu = empty($values['generate_menu']) ? 0 : 1;
        $object->section_seo_name=$values['section_seo_name'];
		$object->currency_id=$values['currency_id'];
		//
		return $object;
	}
}

?>